home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
CLTIME.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-14
|
4KB
|
119 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: class.hpp
// Title: C++ Class Libraries
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains code for the class CL_TIME.
// This code.
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Constants and Local Variables.
//----------------------------------------------------------------------------
#define SECS_PER_DAY (60L*60L*24L)
//----------------------------------------------------------------------------
// Class CL_TIME
//----------------------------------------------------------------------------
#define CL_TIME_PARENT CL_OBJECT
class CLASSTYPE CL_TIME : public CL_TIME_PARENT
{
TIMET ticks; // Number of seconds since Jan 1, 1970
// < 0 is invalid
struct tm tm; // Converted time
BOOL fConverted; // TRUE if tm struct is valid
public:
FN_M CL_TIME(LONG = -1L);
FN_M CL_TIME(SHORT, SHORT, SHORT, SHORT = 0, SHORT = 0, SHORT = 0);
FN_M CL_TIME(RCCL_TIME);
virtual FN_M ~CL_TIME();
BOOL FN_M AddDays(LONG);
BOOL FN_M AddSecs(LONG);
PSZ FN_M AMPM();
PSZ FN_M ampm();
SHORT FN_M Day();
virtual BOOL FN_M Destroy(BOOL = TRUE);
BOOL FN_M Format(RCL_STRING, PCSZ = NULL);
LONG FN_M GetSec() const // Seconds since Jan 1, 1970
{
return ticks;
}
SHORT FN_M Hour(BOOL= FALSE);
virtual BOOL FN_M Initialize(SHORT = CL_INIT_ALL);
virtual BOOL FN_M IsValid() const;
SHORT FN_M JulianDay();
SHORT FN_M Minute();
SHORT FN_M Month();
PSZ FN_M MonthStr(BOOL = FALSE);
static TIMET FN_M Now(PTIMET = NULL);
RCCL_TIME FN_M operator=(RCCL_TIME);
BOOL FN_M operator==(RCCL_TIME) const;
friend LONG FN_M operator-(RCCL_TIME, RCCL_TIME);
BOOL FN_M operator!=(RCCL_TIME) const;
FN_M operator LONG() const
{
return (LONG)ticks;
}
FN_M operator ULONG() const
{
return (ULONG)ticks;
}
virtual BOOL FN_M Retrieve(PCSZ, PCSZ = NULL);
SHORT FN_M Second();
BOOL FN_M Set(SHORT, SHORT, SHORT, SHORT = 0, SHORT = 0, SHORT = 0);
BOOL FN_M SetSec(LONG = -1);
virtual BOOL FN_M Store(PCSZ, PCSZ = NULL);
static BOOL FN_M Validate(SHORT, SHORT, SHORT, SHORT = 0, SHORT = 0, SHORT = 0);
SHORT FN_M Weekday();
PSZ FN_M WeekdayStr(BOOL = FALSE);
SHORT FN_M Year();
#if COMPILE_DEBUG
static VOID FN_M Print(PCCL_TIME = NULL, PCSZ = NULL, SIZET = 0);
static BOOL FN_M Test(SHORT = 0);
#endif
private:
BOOL FN_M Convert();
};
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------